how to split a name js

69

how to split a name js -

var firstName = fullName.split(' ').slice(0, -1).join(' ');
var lastName = fullName.split(' ').slice(-1).join(' ');

Comments

Submit
0 Comments